<?php

//
// +------------------------------------------------------------------------+
// | PHP Version 5.4                                                        |
// +------------------------------------------------------------------------+
// | Copyright (c) 2015-2016 http://www.clcw.com.cn All rights reserved.    |
// +------------------------------------------------------------------------+
// | 世纪车来车往(北京）网络科技有限公司 版权所有！                               |
// | TEL:010-63732365  HOTLINE:400-6688-365  EMAIL:clcw@clcw.com.cn         |
// | $Revision: 1.0 $                                                       |
// +------------------------------------------------------------------------+
// | Author: Xmh <xiangminghu@clcw.com.cn>                                  |
// +------------------------------------------------------------------------+
//

namespace AuctionAppApi\Controller;

use Think\Controller;
use AuctionCore\Other\Carousel;
use AuctionCore\System\AuctionException;

/**
 * 轮播焦点图
 *
 * @author Xmh
 */
class CarouselController extends BaseController {

    public function __construct() {
        parent::__construct();
        $this->Carousel = new Carousel();
    }

    /**
     * 轮播焦点图
     */
    public function index() {
        $page = 1;
        $size = 10;
        $paramer['status'] = '1';
        $paramer['platform'] = '1';
        $list = $this->Carousel->carousel_list($page, $size, $paramer);
        $data = $list['list'];
        $data_info = array();
//        if (array_filter($data)) {
        foreach ($data as $k => $v) {
//                $list_info[$k]['c_id'] = $v['c_id'];
            //砍价临时判断
            $urls = explode('/',$v['param_url']);
            $is_invite = array_pop($urls);
            $is_dealerController = array_pop($urls);
            if(strtolower($is_invite) == strtolower('invite') && strtolower($is_dealerController) == strtolower('dealer')){
                          $data_info[$k]['auth'] = true;
            }
            $data_info[$k]['type'] = $v['type'];
            $data_info[$k]['img'] = $v['focus_picture'];
            if ($v['type'] == '1') {
                $data_info[$k]['scene_id'] = $v['scene_id'];
                $data_info[$k]['name'] = $v['name'];
            } elseif ($v['type'] == '2') {
                $data_info[$k]['url'] = $v['param_url'];
            }
        }
        $this->api_200($data_info);
//        } else {
//            AuctionException::make_throw('100065');
//        }
    }

}
